/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gray.swing.frame;

import java.awt.Container;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import gray.Frame;

/**
 *
 * @author martin
 */
public class RawFrame extends JScrollPane implements Frame<Container>{
    private final Frame<Container>[] _lstCon;

    private RawFrame(final Frame<Container>[] lstCon){
        super();
        JPanel panel = new JPanel();
        setViewportView(panel);
        for (Frame<Container> c : lstCon){
            panel.add(c.container());
        }
        _lstCon=lstCon;
    }
    
    public static Frame<Container> factory(final Frame<Container>[] lstCon){
        return new RawFrame(lstCon);
    }
    
    @Override
    public Container container() {
        return this;
    }
    
    @Override
    public Boolean ready() {
//        for (Frame<Container> f : _lstCon)
        for (int i=0;i<_lstCon.length;i++)
            if (!_lstCon[i].ready())
                return false;
        return true;
    }
}
